$(document).ready(function(){
	
	/* Main-menu active */
	$('ul.main_menu li a,.site-option li a').each(function(){
		var href = $(this).attr('href');
		if( href == $.base64.decode($('#con').val()) ){
			$('ul.main_menu  > li ').removeClass('active');
			$('.site-option ul  > li ').removeClass('active');
			$(this).parent().addClass('active');
			return 0;
		}
	});
	
	/* Map over */
	if((typeof $('.cambodia-map').attr('usemap')) != "undefined"){
		$('.cambodia-map').maphilight();
	}
	$('.province-name').hover(function(e){
		$class = $(this).attr('id');
		$('.' + $class).mouseover();
	},function(e){
		$('.' + $class).mouseout();
	});	
	/* depot tooltip */
	$(document).on('mouseover','.depot-info',function(){		
		$(this).tooltip('show')
	});
	$(document).on('mouseout','.depot-info',function(){
		$(this).tooltip('destroy')
	});	
});
function ingore(e){
	e.preventDefault();
}
function showDepots(e,proId, proName){
	e.preventDefault();
	var base_url = $('#base').val();	
	$.ajax({
		type:'post',
		url: base_url + 'cambodia/get-depots-by-province/',
		data: 'sb_proId=' + proId + "&sb_proName=" + proName,
		beforeSend:function(){
			$('.map-info').html('<span class="loading">&nbsp;</span>');
		},
		success:function(data){
			$('.section').find('.span3').remove();
			$('.section').find('.span9').removeClass('span9').addClass('span12');
			$('.section .span12').find('.span2').removeClass('span2').addClass('span5');
			$('.map-info').html('');
			$('.map-info').html(data);
		}
	});
}